package com.hippo.liteflow.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.catalina.User;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName UserController
 * @Description TODO springDoc 接口测试
 * @Author tangxl
 * @create 2023-03-28 11:33
 **/
@RestController
@RequestMapping("/api/user")
@Tag(name = "swagger测试")
public class UserController {
    @Operation(summary = "user列表",description = "List users by conditions")
    @Parameters({
            @Parameter(in = ParameterIn.HEADER,name = "idToken",description = "The Authorization token",required = true),
            @Parameter(in = ParameterIn.QUERY,name = "status",description = "The user's status"),
            @Parameter(in = ParameterIn.QUERY,name = "department",description = "The user's department")
    })
    @GetMapping("/list")
    public ResponseEntity<Object> listUser(@RequestParam(required = false) String status,
                                           @RequestParam(required = false) String department){
        return ResponseEntity.ok("SUCCESS");
    }

    @Operation(summary = "获取一个user",description = "Get user by id")
    @Parameter(in = ParameterIn.PATH,name = "id",description = "The user's id",required = true)
    @GetMapping("/{id}")
    public ResponseEntity<Object> getUserById(@PathVariable String id){
        return ResponseEntity.ok("SUCCESS");
    }

    @Operation(summary = "创建一个user",description = "Create a user")
    @PostMapping
    public ResponseEntity<Object> createUser(@RequestBody User user){
        return ResponseEntity.ok("SUCCESS");
    }

}
